<template>
	<view class="Myquestion">
		<view class="hotquestion">
			<view class="Questiontitle">
				<text style="color:#333333;font-size: 28rpx;margin:20rpx;font-weight: bold;">热门问题</text>
			</view>
			<view class="method" v-for="item in methodList" :key="item.id" @click="clickQuestion(item.id)">
				<text style="color: #333333;font-size: 28rpx;margin-left: 20rpx;">{{item.problem}}</text>
				<text style="color: #000000;font-weight: bold;font-size: 32rpx;margin-right: 20rpx;">></text>
			</view>
		</view>
		<view class="example">
			<view class="Exq">
				<text style="color: #333333;font-size: 28rpx;padding-top: 20rpx;">Q：交易下单过程中不能付款</text>
			</view>
			<view class="Exq">
				<text style="color: #FEC300;font-size: 28rpx;">A</text>
				<text style="color: #333333;font-size: 28rpx;">：{{oldanser}}</text>
			</view>
		</view>

		<view @click="go()" class="contact">
			<!-- <text style="color: #FFFFFF;font-size: 40rpx;">联系客服</text> -->
			<contact-button type="default-light" size="20" session-from="weapp">
				进入客服对话
			</contact-button>
		</view>
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
				methodList: [],
				answer: '',
				oldanser: '用户您好，可能由于网络延迟或者系统卡顿，请你 稍后片刻在进行操作！如仍有疑问，请联系在线客服。'
			}
		},

		onLoad() {
			// 查询热门问题
			const requestSearch = {
				url: `/api/problemSummary/list`,
				method: "post",
				data: {
					index: 1,
					size: 5,
				},
				callBack: (res) => {
					// console.log(res);
					this.text = 'request success';
					this.methodList = res.data
					// console.log(this.methodList)

				}
			}
			this.$http.request(requestSearch)
		},

		methods: {
			go() {
				uni.navigateTo({
					url: './Service'
				})
			},

			clickQuestion(e) {
				// 常见问题【答案】
				const requestSearch = {
					url: `/api/problemSummary/answer/${e}`,
					method: "get",
					callBack: (res) => {
						console.log(res);
						this.answer = res.data.answer
						if(this.answer==res.data.answer){
							this.oldanser=this.answer
						}
					}
				}
				this.$http.request(requestSearch)
			}
		},
		
	}
</script>

<style>
	.Myquestion {
		width: 100%;
		height: 100vh;
		background-color: #F1F1F1;
		padding: 20rpx;
		position: relative;
	}

	.hotquestion {
		background-color: #FFFFFF;
		border-radius: 3%;
		width: 94%;
	}

	.Questiontitle {
		width: 710rpx;
		height: 60rpx;
		padding-top: 20rpx;
		border-bottom: 1px solid #F1F1F1;
	}

	.method {
		display: flex;
		justify-content: space-between;
		margin-top: 24rpx;
	}

	.example {
		height: 320rpx;
		background-color: #FFFFFF;
		border-radius: 3%;
		width: 94%;
		margin-top: 20rpx;
	}

	.Exq {
		padding-top: 20rpx;
		margin-left: 20rpx;
	}

	.contact {
		width: 710rpx;
		height: 80rpx;
		background-color: #FCC100;
		line-height: 80rpx;
		text-align: center;
		position: absolute;
		bottom: 31rpx;
		border-radius: 10rpx;
	}
</style>
